
"ui";
var color = "#a52a2a";
ui.layout(
    <drawer id="drawer">
        <vertical>
            <appbar bg="#a52a2a">
                <toolbar id="toolbar" title="益友会抢购 v5" />
                {/* <tabs id="tabs" /> */}
            </appbar>
            <viewpager id="viewpager">
                <frame>
                    <ScrollView>
                        <vertical padding="10">
                            <text textSize="16sp" id="networkTest" textColor="#ff7f50" margin="0 5" text="正在检测网络延迟..." />
                            <Switch id="autoService" text="无障碍服务" checked="{{auto.service != null}}" margin="0 10" textSize="15sp" />
                            <horizontal w="*" h="1sp" margin="0 5 0 5" bg='#E2E2E2'></horizontal>
                            <text text="选择时间：" />
                            <horizontal>
                                <radiogroup orientation="horizontal">
                                    <radio id="dx1" text="浙江" checked="true" />
                                    <radio id="dx2" text="北京" />
                                    <radio id="dx3" text="上海" />
                                    <radio id="dx5" text="本机" />
                                </radiogroup>
                            </horizontal>
                            <horizontal w="*" h="1sp" margin="0 10 0 10" bg='#E2E2E2'></horizontal>
                            <horizontal>
                                <checkbox id="随机延迟时间" marginTop="-10" text="  增加随机延迟" />
                                <input id="随机延迟时间1" marginTop="-10" text="10" />
                                <text marginTop="-10" text="-" />
                                <input id="随机延迟时间2" marginTop="-10" text="25" />
                                <text marginTop="-10" text="毫秒" />
                            </horizontal>



                            <horizontal>
                                <checkbox id="随机偏移选择框" marginTop="-10" text="  点击随机偏移" />
                                <input id="随机偏移值" marginTop="-10" text="10" />
                                <text id="像素文本" marginTop="-10" text="像素   点击时长:" />
                                <input id="点击时长" marginTop="-10" text="10" />
                                <text id="毫秒文本" marginTop="-10" text="毫秒" />
                            </horizontal>
                            <horizontal>
                                <text id="这个点点击" text="这个点 点击" />
                                <input id="次数" text="10000" />
                                <text id="每次等待" text="次，每次等待" />
                                <input id="时间间隔" text="5" />
                                <text id="毫秒后再执行" text="毫秒后再执行" />
                            </horizontal>

                            <horizontal>
                                <text id="选择点击模式" textColor="black" marginTop="-5" marginTop="5" text="点击模式：" />
                                <radiogroup orientation="horizontal">
                                    <radio id="ms1" textColor="black" text="模式1" checked="true" />
                                    <radio id="ms2" textColor="black" text="模式2" />
                                    <radio id="ms3" textColor="black" text="模式3" />
                                </radiogroup>
                            </horizontal>
                            <horizontal>
                                <button id="添加" text="添加一个点" />
                                <text id="空1" text="  " />
                                <button id="清除" text="重新设置" style="Widget.AppCompat.Button.Colored" />
                            </horizontal>


                            <horizontal>
                                <spinner id="sp1" marginTop="-8" entries="文字模式1找字(包含)|文字模式1找字(全对)|文字模式2找字(包含)|文字模式2找字(全对)" />
                                <input id="要找的字" marginTop="-8" text="结算(" />
                            </horizontal>
                            <horizontal>
                                <spinner id="sp2" entries="找到后用方法1点击该字|找到后用方法2点击该字|找到后点以下坐标" />
                            </horizontal>
                            <horizontal>
                                <text id="x坐标文本" marginTop="-10" text="   x=" />
                                <input id="x坐标" marginTop="-10" text="100" />
                                <text id="y坐标文本" marginTop="-10" text="y=" />
                                <input id="y坐标" marginTop="-10" text="100" />
                                <text id="点击次数文本" marginTop="-10" text="点击次数" />
                                <input id="点击次数" marginTop="-10" text="3" />
                                <text id="间隔时间文本" marginTop="-10" text="  间隔ms" />
                                <input id="间隔时间ms" marginTop="-10" text="20" />
                            </horizontal>
                            <horizontal>
                                <button id="保存找字" marginTop="-10" text="保存设置" />
                                <button id="取坐标" marginTop="-10" text="取坐标" />
                                <button id="清除设置" marginTop="-10" text="重新设置" style="Widget.AppCompat.Button.Colored" />
                            </horizontal>

                            <horizontal>
                                <button id="结束运行" marginTop="-1" text="添加结束运行" />
                            </horizontal>
                            <horizontal>
                                <button id="输入内容" marginTop="-10" text="添加" />
                                <text id="输入内容2" marginTop="-10" text="输入：" />
                                <input id="输入内容1" marginTop="-10" text="你好" />、

                           </horizontal>


                            <horizontal>
                                <button id="新线程" marginTop="-10" text="添加" />
                                <text id="新线程2" marginTop="-10" text="新线程_循环次数" />
                                <input id="新线程1" marginTop="-10" text="1" />

                            </horizontal>

                            <horizontal>
                                <button id="添加延时" marginTop="-10" text="添加" />
                                <text id="添加延时1" marginTop="-10" text="延时" />
                                <input id="添加延时2" marginTop="-10" text="100" />
                                <text id="添加延时3" marginTop="-10" text="毫秒" />


                            </horizontal>
                            <horizontal w="*" h="1sp" margin="0 10 0 10" bg='#E2E2E2'></horizontal>

                            <horizontal>
                                <text text="模式：" marginTop="2" />
                                <radiogroup orientation="horizontal">

                                    <radio id="zz" text="找字点击" marginTop="-5" />
                                    <radio id="zb" text="坐标点击" marginTop="-5"  checked="true"/>
                                    <radio id="ys" text="其它功能" marginTop="-5" />
                                </radiogroup>
                            </horizontal>
                            <horizontal w="*" h="1sp" margin="0 10 0 10" bg='#E2E2E2'></horizontal>

                            {/* <horizontal w="*" h="1sp" margin="0 10 0 20" bg='#E2E2E2'></horizontal> */}
                            <horizontal>
                                <text textColor="black" marginTop="-10" text="开始时间：" />
                                <input id="startTime" marginTop="-10" text="0" />
                            </horizontal>
                            <horizontal>
                                <text textColor="black" marginTop="-10" text="提前" />
                                <input id="forwardTime" marginTop="-10" text="200" />

                                <text textColor="black" marginTop="-10" text="ms开始执行" />
                                {/* <input id="循环次数" marginTop="-10" text="1" />
                               <text textColor="black" marginTop="-10" text="次" /> */}
                            </horizontal>
                            <horizontal w="*" h="1sp" margin="0 10 0 10" bg='#E2E2E2'></horizontal>
                            <button id="runSrt" style="Widget.AppCompat.Button.Colored" marginTop="-5" text="开始运行" />
                            <horizontal w="*" h="1sp" margin="0 10 0 10" bg='#E2E2E2'></horizontal>
                            <input id="记录" marginTop="-10" text="" />

                            {/* <input id="33" text="0df<br>656"/> */}
                            <text id="qqq" gravity="center" textColor="red" text="本脚本为益友会定制版.请选择坐标点击.添加一个点.设置次数9999次.开发者九黎qq1906507927" />
                        </vertical>
                    </ScrollView>
                </frame>

            </viewpager>

        </vertical>

        <vertical layout_gravity="left" bg="#ffffff" w="230">
            <img w="280" h="200" scaleType="fitXY" src="http://images.shejidaren.com/wp-content/uploads/2014/10/023746fki.jpg" />
            <list id="menu">
                <horizontal bg="?selectableItemBackground" w="*">
                    <img w="50" h="50" padding="16" src="{{this.icon}}" tint="{{color}}" />
                    <text textColor="black" textSize="15sp" text="{{this.title}}" layout_gravity="center" />
                </horizontal>
            </list>
        </vertical>
    </drawer>
);
ui.新线程.on("click", (checked) => {//添加新线程
    var 原来的内容 = ui.记录.getText().toString() + "<<>>线程|" + ui.新线程2.getText().toString() + "|_|";
    ui.记录.setText(原来的内容);
});

ui.结束运行.on("click", (checked) => {//添加结束
    var 原来的内容 = ui.记录.getText().toString() + "结束|<->";
    ui.记录.setText(原来的内容);
});
ui.输入内容.on("click", (checked) => {//添加结束
    var 原来的内容 = ui.记录.getText().toString() + "输入|" + ui.输入内容1.getText().toString() + "<->";
    ui.记录.setText(原来的内容);
});



ui.添加延时.on("click", (checked) => {//切换到坐标点击模式
    var 原来的内容 = ui.记录.getText().toString() + "延时" + "|" + ui.添加延时2.getText().toString() + "<->";
    ui.记录.setText(原来的内容);
});

ui.清除设置.on("click", (checked) => {//切换到坐标点击模式
    ui.记录.setText("<<>>线程|1|_|");

});



ui.取坐标.on("click", (checked) => {//切换到坐标点击模式
    if (ui.取坐标.getText() == "取坐标") {
        ui.取坐标.setText('保存坐标');
        显示按钮啦()

    } else {
        floaty.closeAll();
        //关闭悬浮=1;
        //  ui.添加.setText('添加一个点');
        ui.取坐标.setText('取坐标');
        ui.x坐标.setText(Math.round(按钮x).toString());
        ui.y坐标.setText(Math.round(按钮y).toString());
    }

});
ui.保存找字.on("click", (checked) => {//切换到坐标点击模式
    if (checked) {

        var i = ui.sp1.getSelectedItemPosition();
        if (i == 0) { i = "用模式1找(包含)" }
        if (i == 1) { i = "用模式1找(全对)" }
        if (i == 2) { i = "用模式2找(包含)" }
        if (i == 3) { i = "用模式2找(全对)" }
        var j = ui.sp2.getSelectedItemPosition();
        if (j == 0) { j = "找到后用方法1点击该字" }
        if (j == 1) { j = "找到后用方法2点击该字" }
        if (j == 2) { j = "找到后点以下坐标" }

        var 原来的内容 = ui.记录.getText().toString() + "找字点击" + "|";
        if (ui.sp2.getSelectedItemPosition() < 3) {
            原来的内容 = 原来的内容 + i + "|" + ui.要找的字.getText().toString() + "|" + j + "<->";
        } else {
            原来的内容 = 原来的内容 + i + "|" + ui.要找的字.getText().toString() + "|" + j + "|" + ui.x坐标.getText().toString() + "|" + ui.y坐标.getText().toString() + "|" + ui.点击次数.getText().toString() + "|" + ui.间隔时间ms.getText().toString() + "<->";
        }

        ui.记录.setText(原来的内容);
    }
});

ui.zz.on("check", (checked) => {//切换到找字模式
    if (checked) {
        ui.随机偏移选择框.visibility = 8;//隐藏是8  显示是0
        ui.随机偏移值.visibility = 8;
        ui.像素文本.visibility = 8;
        ui.点击时长.visibility = 8;
        ui.毫秒文本.visibility = 8;
        ui.次数.visibility = 8;
        ui.这个点点击.visibility = 8;
        ui.每次等待.visibility = 8;
        ui.时间间隔.visibility = 8;
        ui.毫秒后再执行.visibility = 8;
        ui.添加.visibility = 8;
        ui.空1.visibility = 8;
        ui.清除.visibility = 8;
        ui.ms1.visibility = 8;
        ui.ms2.visibility = 8;
        ui.ms3.visibility = 8;
        ui.选择点击模式.visibility = 8;
        ui.添加延时.visibility = 8;
        ui.添加延时1.visibility = 8;
        ui.添加延时2.visibility = 8;
        ui.添加延时3.visibility = 8;
        ui.新线程.visibility = 8;
        ui.新线程1.visibility = 8;
        ui.新线程2.visibility = 8;
        ui.输入内容.visibility = 8;
        ui.输入内容1.visibility = 8;
        ui.输入内容2.visibility = 8;
        ui.结束运行.visibility = 8;


        //-----------------------------------------------分组------------
        ui.sp1.visibility = 0;
        ui.要找的字.visibility = 0;
        ui.sp2.visibility = 0;
        ui.x坐标文本.visibility = 0;
        ui.x坐标.visibility = 0;
        ui.y坐标文本.visibility = 0;
        ui.y坐标.visibility = 0;
        ui.保存找字.visibility = 0;
        ui.点击次数.visibility = 0;
        ui.间隔时间文本.visibility = 0;
        ui.间隔时间ms.visibility = 0;
        ui.点击次数文本.visibility = 0;
        ui.清除设置.visibility = 0;
        ui.取坐标.visibility = 0;

    }
});

ui.zb.on("check", (checked) => {//切换到坐标点击模式
    if (checked) {
        ui.随机偏移选择框.visibility = 0;//隐藏是8  显示是0
        ui.随机偏移值.visibility = 0;
        ui.像素文本.visibility = 0;
        ui.点击时长.visibility = 0;
        ui.毫秒文本.visibility = 0;
        ui.次数.visibility = 0;
        ui.这个点点击.visibility = 0;
        ui.每次等待.visibility = 0;
        ui.时间间隔.visibility = 0;
        ui.毫秒后再执行.visibility = 0;
        ui.添加.visibility = 0;
        ui.空1.visibility = 0;
        ui.清除.visibility = 0;
        ui.ms1.visibility = 0;
        ui.ms2.visibility = 0;
        ui.ms3.visibility = 0;
        ui.选择点击模式.visibility = 0;

        //-----------------------------------------------分组------------
        ui.sp1.visibility = 8;
        ui.要找的字.visibility = 8;
        ui.sp2.visibility = 8;
        ui.x坐标文本.visibility = 8;
        ui.x坐标.visibility = 8;
        ui.y坐标文本.visibility = 8;
        ui.y坐标.visibility = 8;
        ui.保存找字.visibility = 8;
        ui.点击次数.visibility = 8;
        ui.间隔时间文本.visibility = 8;
        ui.间隔时间ms.visibility = 8;
        ui.点击次数文本.visibility = 8;
        ui.清除设置.visibility = 8;
        ui.取坐标.visibility = 8;
        ui.添加延时.visibility = 8;
        ui.添加延时1.visibility = 8;
        ui.添加延时2.visibility = 8;
        ui.添加延时3.visibility = 8;
        ui.新线程.visibility = 8;
        ui.新线程1.visibility = 8;
        ui.新线程2.visibility = 8;
        ui.输入内容.visibility = 8;
        ui.输入内容1.visibility = 8;
        ui.输入内容2.visibility = 8;
        ui.结束运行.visibility = 8;
    }
});
ui.ys.on("check", (checked) => {//切换到添加延时模式
    if (checked) {
        ui.随机偏移选择框.visibility = 8;//隐藏是8  显示是0
        ui.随机偏移值.visibility = 8;
        ui.像素文本.visibility = 8;
        ui.点击时长.visibility = 8;
        ui.毫秒文本.visibility = 8;
        ui.次数.visibility = 8;
        ui.这个点点击.visibility = 8;
        ui.每次等待.visibility = 8;
        ui.时间间隔.visibility = 8;
        ui.毫秒后再执行.visibility = 8;
        ui.添加.visibility = 8;
        ui.空1.visibility = 8;
        ui.清除.visibility = 8;
        ui.ms1.visibility = 8;
        ui.ms2.visibility = 8;
        ui.ms3.visibility = 8;
        ui.选择点击模式.visibility = 8;


        ui.sp1.visibility = 8;
        ui.要找的字.visibility = 8;
        ui.sp2.visibility = 8;
        ui.x坐标文本.visibility = 8;
        ui.x坐标.visibility = 8;
        ui.y坐标文本.visibility = 8;
        ui.y坐标.visibility = 8;
        ui.保存找字.visibility = 8;
        ui.点击次数.visibility = 8;
        ui.间隔时间文本.visibility = 8;
        ui.间隔时间ms.visibility = 8;
        ui.点击次数文本.visibility = 8;
        ui.清除设置.visibility = 8;
        ui.取坐标.visibility = 8;
        ui.添加延时.visibility = 8;
        ui.添加延时1.visibility = 8;
        ui.添加延时2.visibility = 8;
        ui.添加延时3.visibility = 8;
        //-----------------------------------------------分组------------
        ui.添加延时.visibility = 0;
        ui.添加延时1.visibility = 0;
        ui.添加延时2.visibility = 0;
        ui.添加延时3.visibility = 0;
        ui.新线程.visibility = 0;
        ui.新线程1.visibility = 0;
        ui.新线程2.visibility = 0;
        ui.输入内容.visibility = 0;
        ui.输入内容1.visibility = 0;
        ui.输入内容2.visibility = 0;
        ui.结束运行.visibility = 0;
    }
});



ui.随机偏移选择框.visibility = 8;//隐藏是8  显示是0
ui.随机偏移值.visibility = 8;
ui.像素文本.visibility = 8;
ui.点击时长.visibility = 8;
ui.毫秒文本.visibility = 8;
ui.次数.visibility = 8;
ui.这个点点击.visibility = 8;
ui.每次等待.visibility = 8;
ui.时间间隔.visibility = 8;
ui.毫秒后再执行.visibility = 8;
ui.添加.visibility = 8;
ui.空1.visibility = 8;
ui.清除.visibility = 8;
ui.ms1.visibility = 8;
ui.ms2.visibility = 8;
ui.ms3.visibility = 8;
ui.选择点击模式.visibility = 8;
ui.添加延时.visibility = 8;
ui.添加延时1.visibility = 8;
ui.添加延时2.visibility = 8;
ui.添加延时3.visibility = 8;
ui.新线程.visibility = 8;
ui.新线程1.visibility = 8;
ui.新线程2.visibility = 8;
ui.输入内容.visibility = 8;
ui.输入内容1.visibility = 8;
ui.输入内容2.visibility = 8;
ui.结束运行.visibility = 8;



var startTime, forwardTime, interval, lastTime, NTPClockOffset, NTPClockDelay, sjpyz, sxlm, 时间通道, startChecktimeFix, forwardTime;
var sjyssj1, sjyssj2, 随机偏移, xhcs, djl = "", 记录, bbh = 120, 关闭悬浮 = 0, djms = 1, ycsj, 使用次数;
//home.activate();

var storage = storages.create("tmalltaobaohelper.byfly");
var sjysm = 0;
var content = storage.get("随机延迟时间");
if (content != null) {
    if (content == "真") {
        ui.随机延迟时间.setChecked(true);
        sjysm = 1;
    }
}
ui.随机延迟时间.on("check", (checked) => {
    if (checked) {
        sjysm = 1;
        storage.put("随机延迟时间", "真");
    } else {
        sjysm = 0;
        storage.put("随机延迟时间", "假");
    }
});


var sjpym = 0;
var content = storage.get("随机偏移");
if (content != null) {
    if (content == "真") {
        ui.随机偏移选择框.setChecked(true);
        sjpym = 1;
    }
} else {
    ui.随机偏移选择框.setChecked(true);
    sjpym = 0;
}


ui.随机偏移选择框.on("check", (checked) => {
    if (checked) {
        sjpym = 1;
        storage.put("随机偏移", "真");
    } else {
        sjpym = 0;
        storage.put("随机偏移", "假");
    }
});
var about = dialogs.build({
    //对话框标题
    title: "关于",
    //对话框内容
    content: "定制版",
    //确定键内容
    positive: "确定",
    //取消键内容
    // negative: "关闭",
    //中性键内容
    // neutral: "去微信",
    //}).on("neutral", () => {
    //监听中性键
    //  threads.start(contect);
});

function contect() {
    var key = "0f24xxsPcn1K6m7Mcc7IMdno-Z8AStxz";
    app.startActivity({
        action: "android.intent.action.VIEW",
        data: "mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key,
        packageName: "com.tencent.mobileqq",
    });
}

var jqq = dialogs.build({
    //对话框标题
    title: "重要通知!",
    //对话框内容
    content: "定制版",
    //确定键内容
    //  positive: "确定",
    //取消键内容
    // negative: "关闭",
    //中性键内容
    neutral: "一键加群",
}).on("neutral", () => {
    //监听中性键
    threads.start(contect);
});

var 时间通道 = "http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp";
//var 时间通道="https://a.jd.com//ajax/queryServerData.html"
//var 时间通道="http://api.pinduoduo.com:80/api/server/_stm"
ui.dx1.on("check", (checked) => {
    if (checked) {
        时间通道 = "http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp";
        var thread = threads.start(function () {
            网络校时();
        });

        ui.networkTest.setText("重新校时...");
        thread.join(2000);
        // ui.networkTest.setText("当前设备时间与网络时间相差" + 网络时间差 + "  网络延迟：" + 网络延时 + "ms");
        ui.networkTest.setText("首发Q群：596614201   网络延迟：" + 网络延时 + "ms");
    }
});
ui.dx2.on("check", (checked) => {
    if (checked) {
        时间通道 = "https://a.jd.com//ajax/queryServerData.html";
        var thread = threads.start(function () {
            网络校时();
        });
        ui.networkTest.setText("重新校时...");
        thread.join(2000);
        //  ui.networkTest.setText("当前设备时间与网络时间相差" + 网络时间差 + "  网络延迟：" + 网络延时 + "ms");
        ui.networkTest.setText("首发Q群：596614201   网络延迟：" + 网络延时 + "ms");
    }
});
ui.dx3.on("check", (checked) => {
    if (checked) {
        时间通道 = "http://api.pinduoduo.com:80/api/server/_stm";
        var thread = threads.start(function () {
            网络校时();
        });
        ui.networkTest.setText("重新校时...");
        thread.join(2000);
        // ui.networkTest.setText("当前设备时间与网络时间相差" + 网络时间差 + "  网络延迟：" + 网络延时 + "ms");
        ui.networkTest.setText("首发Q群：596614201   网络延迟：" + 网络延时 + "ms");
    }
});
// ui.dx4.on("check", (checked)=>{
//     if(checked){
//         时间通道="http://api.k780.com:80/?app=life.time&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json"

//     }
// });
ui.dx5.on("check", (checked) => {
    if (checked) {
        时间通道 = "";
        ui.networkTest.setText("当前使用设备时间");
        wlsjc = 0;
        网络延时 = 0;
    }
});
ui.ms1.on("check", (checked) => {
    if (checked) {
        djms = 1;
        storage.put("点击模式", "1");
    }
});
ui.ms2.on("check", (checked) => {
    if (checked) {
        djms = 2;
        storage.put("点击模式", "2");
    }
});
ui.ms3.on("check", (checked) => {
    if (checked) {
        djms = 3;
        toast("此模式点击时长固定为150！")
        storage.put("点击模式", "3");
    }
});
var content = storage.get("点击模式");
if (content != null) {
    if (content == "1") {
        ui.ms1.setChecked(true);
        djms = 1;
    }
    else
        if (content == "2") {
            ui.ms2.setChecked(true);
            djms = 2;
        }
        else if (content == "3") {
            ui.ms3.setChecked(true);
            djms = 3;
        }

}
//    else {
//     ui.ms1.setChecked(true);
//     djms = 1;
// }


//让工具栏左上角可以打开侧拉菜单
ui.toolbar.setupWithDrawer(ui.drawer);

ui.menu.setDataSource([
    {
        title: "使用说明",
        icon: "@drawable/ic_settings_black_48dp",
        onclick: () => 使用说明()
    },
    {
        title: "恢复默认值",
        icon: "@drawable/ic_android_black_48dp",
        onclick: () => restore()
    },
    {
        title: "日志",
        icon: "@drawable/ic_find_in_page_black_48dp",
        onclick: () => app.startActivity('console')
    },
    // {
    //     title: "系统设置",
    //         icon: "@drawable/ic_settings_black_48dp",
    //     onclick: () => app.startActivity('settings')
    // },
    {
        title: "关于",
        icon: "@drawable/ic_favorite_black_48dp",
        onclick: () => about.show()


    },
    {
        title: "退出",
        icon: "@drawable/ic_exit_to_app_black_48dp",
        onclick: () => ui.finish()
    }
]);

ui.menu.on("item_click", item => {
    if (item.onclick) item.onclick();
    ui.drawer.closeDrawers();
});
function 使用说明() {
    app.openUrl("https://shimo.im/docs/vxRDVVwdkW9d38DQ/");
}

function setContainer(v) {
    ui.body.removeAllViews();
    ui.body.addView(v, new android.widget.FrameLayout.LayoutParams(-1, -1));
}

function restore() {
    storage.clear();
    threads.start(NTP.sync);
    setTimeout(initConfig, 500);
    toast("参数已重置");
}
var middle = device.width * 0.1;
console.setPosition(middle, 0);
console.setSize(device.width * 0.8, device.height / 3);

ui.添加.on("click", function () {
    if (ui.添加.getText() == "添加一个点") {

        threads.start(function () {

            console.show();
            sleep(50);
            显示按钮啦();
            //  sleep(100);

        });
        // 关闭悬浮=0;

        按钮x = 100;
        按钮y = 100;
        ui.添加.setText('保存位置');
        logWithTime("把按钮移动到你想要点击的位置，再切换回来保存。");
    } else {
        floaty.closeAll();
        //关闭悬浮=1;
        ui.添加.setText('添加一个点');
        需点击次数 = parseInt(ui.次数.getText());
        时间间隔 = parseInt(ui.时间间隔.getText());
        点击时长 = parseInt(ui.点击时长.getText());
        var 原来的内容 = ui.记录.getText().toString() + "坐标点击" + "|";
        原来的内容 = 原来的内容 + Math.round(按钮x) + "|" + Math.round(按钮y) + "|" + 需点击次数 + "|" + 时间间隔 + "|" + 点击时长 + "<->";
        ui.记录.setText(原来的内容);

        logWithTime("成功添加:x=" + Math.round(按钮x) + " y=" + Math.round(按钮y) + " 点击次数=" + 需点击次数 + " 时间间隔=" + 时间间隔 + " 点击时长=" + 点击时长);
    }

});
ui.清除.on("click", function () {
    djl = "<<>>线程|1|_|";
    ui.记录.setText(djl);
    logWithTime("已清除保存的点！");
});
ui.autoService.on("check", function (checked) {
    // 用户勾选无障碍服务的选项时，跳转到页面让用户去开启
    if (checked && auto.service == null) {
        app.startActivity({
            action: "android.settings.ACCESSIBILITY_SETTINGS"
        });
    }
    if (!checked && auto.service != null) {
        auto.service.disableSelf();
    }
});

// 当用户回到本界面时，resume事件会被触发
ui.emitter.on("resume", function () {
    // 此时根据无障碍服务的开启情况，同步开关的状态
    if (ui.autoService) {
        ui.autoService.checked = auto.service != null;
    }
});

// 获取默认开始时间


// 获取时分秒用于记录日志
function logWithTime(msg) {
    console.log(formatDate(getNow()) + " " + msg);
}
var 网络延时 = 0, wlsjc = 0;
function 网络校时() {
    // for (i = 0; i < 3; i++) {
    //     timestamp1 = new Date().getTime();
    //     r = http.get(时间通道);
    //     timestamp2 = new Date().getTime();
    //     网络延时 = timestamp2 - timestamp1;
    //     网络延时 = 网络延时 / 2;
    //     var objj = r.body.json();
    if (时间通道 == "http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp") {
        // 网络时间差 = timestamp1 - objj.data.t - 网络延时;//网络时间差;
        thread1 = threads.start(NTP.sync);
        //setTimeout(initConfig, 1000);
        thread1.join(2000);
        // return
    }
    else if (时间通道 == "https://a.jd.com//ajax/queryServerData.html") {
        // 网络时间差 = timestamp1 - objj.serverTime - 网络延时;//网络时间差
        thread1 = threads.start(NTPjd.sync);
        //setTimeout(initConfig, 1000);
        thread1.join(2000);
        // return
    }
    else if (时间通道 == "http://api.pinduoduo.com:80/api/server/_stm") {
        //网络时间差 = timestamp1 - objj.server_time - 网络延时;//网络时间差
        thread1 = threads.start(NTPpdd.sync);
        //setTimeout(initConfig, 1000);
        thread1.join(2000);
        //return
    }

}


var NTPjd = {
    requiredResponses: 3,
    serverTimes: [],
    serverDelay: [],
    serverUrl: "https://a.jd.com//ajax/queryServerData.html",
    resyncTime: 0, // minutes
    sync: function () {
        var offset = storage.get("NTPjdClockOffset");
        if (offset) {
            try {
                var t = offset.split("|")[1];
                var d = NTPjd.fixTime() - parseInt(t, 10);
                if (d < (1000 * 60 * NTPjd.resyncTime)) {
                    return false;
                }
            } catch (e) {
            }
        }
        NTPjd.getServerTime();
    },
    getNow: function () {
        var date = new Date();
        return date.getTime();
    },
    parseServerResponse: function (data) {
        var NtpjdStartTime = storage.get("NtpjdStartTime");
        var NtpjdStopTime = NTPjd.getNow();
        var origtime = parseInt(data.serverTime);

        var delay = ((NtpjdStopTime - NtpjdStartTime) / 2);
        var offset = NtpjdStopTime - origtime - delay;
        NTPjd.serverTimes.push(offset);
        NTPjd.serverDelay.push(delay);

        // 因为网络问题，需要多次获取偏移值，获取平均值
        if (NTPjd.serverTimes.length >= NTPjd.requiredResponses) {
            var sumOffset = 0;
            var sumDelay = 0;
            var i = 0;
            for (i = 0; i < NTPjd.serverTimes.length; i++) {
                sumOffset += NTPjd.serverTimes[i];
                sumDelay += NTPjd.serverDelay[i];
            }
            var averageOffset = Math.round(sumOffset / i);
            var averageDelay = Math.round(sumDelay / i);
            storage.put("NTPjdClockOffset", averageOffset + '|' + NTPjd.fixTime()); // 保存获得offset时的时间戳
            storage.put("NTPjdClockDelay", averageDelay); // 保存获得offset时的时间戳
            wlsjc = averageOffset;
            网络延时 = averageDelay;
        } else {
            NTPjd.getServerTime();
        }
    },
    getServerTime: function () {
        var NtpjdStartTime = NTPjd.getNow();
        storage.put("NtpjdStartTime", NtpjdStartTime);

        var res = http.get(NTPjd.serverUrl);
        if (res.statusCode !== 200) {
            toast("获取网络时间失败: " + res.statusCode + " " + res.statusMessage);
            return false;
        } else {
            NTPjd.parseServerResponse(res.body.json());
        }
    },
    fixTime: function (timeStamp) {
        if (!timeStamp) {
            timeStamp = NTPjd.getNow();
        }
        var offset = storage.get("NTPjdClockOffset");
        try {
            if (!offset) {
                offset = 0;
            } else {
                offset = offset.split("|")[0];
            }
            if (isNaN(parseInt(offset, 10))) {
                return timeStamp;
            }
            return timeStamp + parseInt(offset, 10);
        } catch (e) {
            return timeStamp;
        }
    }
};


var NTPpdd = {
    requiredResponses: 3,
    serverTimes: [],
    serverDelay: [],
    serverUrl: "http://api.pinduoduo.com/api/server/_stm",
    resyncTime: 0, // minutes
    sync: function () {
        var offset = storage.get("NTPpddClockOffset");
        if (offset) {
            try {
                var t = offset.split("|")[1];
                var d = NTPpdd.fixTime() - parseInt(t, 10);
                if (d < (1000 * 60 * NTPpdd.resyncTime)) {
                    return false;
                }
            } catch (e) {
            }
        }
        NTPpdd.getServerTime();
    },
    getNow: function () {
        var date = new Date();
        return date.getTime();
    },
    parseServerResponse: function (data) {
        var NtppddStartTime = storage.get("NtppddStartTime");
        var NtppddStopTime = NTPpdd.getNow();
        var origtime = parseInt(data.server_time);
        var delay = ((NtppddStopTime - NtppddStartTime) / 2);
        var offset = NtppddStopTime - origtime - delay;
        NTPpdd.serverTimes.push(offset);
        NTPpdd.serverDelay.push(delay);

        // 因为网络问题，需要多次获取偏移值，获取平均值
        if (NTPpdd.serverTimes.length >= NTPpdd.requiredResponses) {
            var sumOffset = 0;
            var sumDelay = 0;
            var i = 0;
            for (i = 0; i < NTPpdd.serverTimes.length; i++) {
                sumOffset += NTPpdd.serverTimes[i];
                sumDelay += NTPpdd.serverDelay[i];
            }
            var averageOffset = Math.round(sumOffset / i);
            var averageDelay = Math.round(sumDelay / i);
            storage.put("NTPpddClockOffset", averageOffset + '|' + NTPpdd.fixTime()); // 保存获得offset时的时间戳
            storage.put("NTPpddClockDelay", averageDelay); // 保存获得offset时的时间戳
            wlsjc = averageOffset;
            网络延时 = averageDelay;

        } else {
            NTPpdd.getServerTime();
        }
    },
    getServerTime: function () {
        var NtppddStartTime = NTPpdd.getNow();
        storage.put("NtppddStartTime", NtppddStartTime);

        var res = http.get(NTPpdd.serverUrl);
        if (res.statusCode !== 200) {
            toast("获取网络时间失败: " + res.statusCode + " " + res.statusMessage);
            return false;
        } else {
            NTPpdd.parseServerResponse(res.body.json());
        }
    },
    fixTime: function (timeStamp) {
        if (!timeStamp) {
            timeStamp = NTPpdd.getNow();
        }
        var offset = storage.get("NTPpddClockOffset");
        try {
            if (!offset) {
                offset = 0;
            } else {
                offset = offset.split("|")[0];
            }
            if (isNaN(parseInt(offset, 10))) {
                return timeStamp;
            }
            return timeStamp + parseInt(offset, 10);
        } catch (e) {
            return timeStamp;
        }
    }
};


var NTP = {
    requiredResponses: 3,
    serverTimes: [],
    serverDelay: [],
    serverUrl: "http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp",
    resyncTime: 0, // minutes
    sync: function () {
        var offset = storage.get("NTPClockOffset");
        if (offset) {
            try {
                var t = offset.split("|")[1];
                var d = NTP.fixTime() - parseInt(t, 10);
                if (d < (1000 * 60 * NTP.resyncTime)) {
                    return false;
                }
            } catch (e) {
            }
        }
        NTP.getServerTime();
    },
    getNow: function () {
        var date = new Date();
        return date.getTime();
    },
    parseServerResponse: function (data) {
        var NtpStartTime = storage.get("NtpStartTime");
        var NtpStopTime = NTP.getNow();

        var origtime = parseInt(data.data.t);

        var delay = ((NtpStopTime - NtpStartTime) / 2);
        var offset = NtpStopTime - origtime - delay;
        NTP.serverTimes.push(offset);
        NTP.serverDelay.push(delay);

        // 因为网络问题，需要多次获取偏移值，获取平均值
        if (NTP.serverTimes.length >= NTP.requiredResponses) {
            var sumOffset = 0;
            var sumDelay = 0;
            var i = 0;
            for (i = 0; i < NTP.serverTimes.length; i++) {
                sumOffset += NTP.serverTimes[i];
                sumDelay += NTP.serverDelay[i];
            }
            var averageOffset = Math.round(sumOffset / i);
            var averageDelay = Math.round(sumDelay / i);
            storage.put("NTPClockOffset", averageOffset + '|' + NTP.fixTime()); // 保存获得offset时的时间戳
            storage.put("NTPClockDelay", averageDelay); // 保存获得offset时的时间戳
            wlsjc = averageOffset;
            网络延时 = averageDelay;
            // logWithTime("脚本开始运行，当前时间偏移: " + averageOffset + " 网络延迟: " + averageDelay);
        } else {
            NTP.getServerTime();
        }
    },
    getServerTime: function () {
        var NtpStartTime = NTP.getNow();
        storage.put("NtpStartTime", NtpStartTime);

        var res = http.get(NTP.serverUrl);
        if (res.statusCode !== 200) {
            toast("获取网络时间失败: " + res.statusCode + " " + res.statusMessage);
            return false;
        } else {
            NTP.parseServerResponse(res.body.json());
        }
    },
    fixTime: function (timeStamp) {
        if (!timeStamp) {
            timeStamp = NTP.getNow();
        }
        var offset = storage.get("NTPClockOffset");
        try {
            if (!offset) {
                offset = 0;
            } else {
                offset = offset.split("|")[0];
            }
            if (isNaN(parseInt(offset, 10))) {
                return timeStamp;
            }
            return timeStamp + parseInt(offset, 10);
        } catch (e) {
            return timeStamp;
        }
    }
};


// 初始化用户配置
// storage.clear();

threads.start(NTP.sync);
setTimeout(initConfig, 1000);

function initConfig() {
    // NTPClockOffset = storage.get("NTPClockOffset", "0");
    // NTPClockDelay = storage.get("NTPClockDelay", "0");
    // if (!NTPClockOffset) {
    //     NTPClockOffset = 0;
    // } else {
    //     NTPClockOffset = parseInt(NTPClockOffset.split("|")[0]);
    // }
    // if (NTPClockOffset < 0) {
    //     var offset_str = "慢了" + -NTPClockOffset + 'ms，';
    // } else {
    //     offset_str = "快了" + NTPClockOffset + 'ms，';
    // }
    if (wlsjc == null) {
        ui.networkTest.setText("网络校时超时！请换其它接口，或重启app");
    } else {
        // ui.networkTest.setText("本机与网络时间相差" + 网络时间差 + "ms 网络延迟：" + 网络延时 + "ms");
        ui.networkTest.setText("Q群：596614201首发 网络延迟：" + 网络延时 + "ms");
    }


    ui.startTime.setText(getTime1());
    ui.forwardTime.setText(storage.get("forwardTime", "80").toString());
    ui.次数.setText(storage.get("需点击次数", "1").toString());
    ui.时间间隔.setText(storage.get("时间间隔", "300").toString());
    ui.随机延迟时间1.setText(storage.get("随机延迟时间1", "10").toString());
    ui.随机延迟时间2.setText(storage.get("随机延迟时间2", "25").toString());
    ui.随机偏移值.setText(storage.get("随机偏移值", "10").toString());
    ui.记录.setText(storage.get("点记录", "<<>>线程|1|_|").toString());
    // ui.循环次数.setText(storage.get("循环次数", "1").toString());
    ui.点击时长.setText(storage.get("点击时长", "10").toString());
}

// 检测时间字符串是否有效
function strDateTime(str) {
    var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
    var r = str.match(reg);
    if (r == null) return false;
    var d = new Date(r[1], r[3] - 1, r[4], r[5], r[6], r[7]);
    return (d.getFullYear() == r[1] && (d.getMonth() + 1) == r[3] && d.getDate() == r[4] && d.getHours() == r[5] && d.getMinutes() == r[6] && d.getSeconds() == r[7]);
}

// 时间戳转时间字符串
function add0(m) {
    return m < 10 ? '0' + m : m
}

function formatDate(needTime) {
    //needTime是整数，否则要parseInt转换
    var time = new Date(parseInt(needTime));
    var h = time.getHours();
    var mm = time.getMinutes();
    var s = time.getSeconds();
    var ms = time.getMilliseconds();
    return add0(h) + ':' + add0(mm) + ':' + add0(s) + ':' + ms;
}

// 根据时间偏移值计算真实时间
function getNow() {
    var now = new Date().getTime();
    // if (ui.isUseNetTime.isChecked()) {
    return now - wlsjc;
    //  }
    //return now
}
//threads.start(jcsq);
// 程序主要逻辑
ui.runSrt.click(function () {
    // 检查无障碍服务


    // if (getNow() > 1592205396000) {
    //     ui.runSrt.setText('Q群：315250592');
    //     jqq.show();
    //     console.hide();
    //     device.cancelKeepingAwake();

    //     threads.shutDownAll();
    // }

    if (auto.service == null) {
        toast("请先开启无障碍服务！");
        return;
    }


    //运行
    startTime = ui.startTime.getText().toString();
    sjyssj1 = parseInt(ui.随机延迟时间1.getText());
    sjyssj2 = parseInt(ui.随机延迟时间2.getText());
    sjpyz = parseInt(ui.随机偏移值.getText());
    djl = ui.记录.getText().toString();
    //  xhcs = parseInt(ui.循环次数.getText());
    forwardTime = parseInt(ui.forwardTime.getText());
    需点击次数 = parseInt(ui.次数.getText());
    时间间隔 = parseInt(ui.时间间隔.getText());
    点击时长 = parseInt(ui.点击时长.getText());
    // flushTime = parseInt(ui.flushTime.getText());
    // interval = parseInt(ui.interval.getText());
    // lastTime = parseInt(ui.lastTime.getText());

    if (djl == "") {
        toast("请先设置点击坐标！");
        return;
    }

    if (!strDateTime(startTime)) {
        ui.startTime.setError("请输入正确的日期");
        toast("请输入正确的日期");
        return;
    } else if (forwardTime > 3000) {
        ui.forwardTime.setError("请输入0-3000之间的值");
        toast("请输入0-3000之间的值");
        return;
    }
    // storage.put("isUseNetTime", isUseNetTime);
    storage.put("随机延迟时间1", sjyssj1);
    storage.put("随机延迟时间2", sjyssj2);
    storage.put("随机偏移值", sjpyz);
    storage.put("需点击次数", 需点击次数);
    storage.put("时间间隔", 时间间隔);
    storage.put("点记录", djl);
    //  storage.put("循环次数", xhcs);
    storage.put("forwardTime", forwardTime);
    storage.put("点击时长", 点击时长);
    //  storage.put("flushTime", flushTime);
    // storage.put("interval", interval);
    //storage.put("lastTime", lastTime);
    // retryTimes = Math.round(lastTime * 1000 / interval);
    // storage.put("isUseNetTime", isUseNetTime);
    使用次数 = 使用次数 + 1;
    storage.put("使用次数", String(使用次数));

    if (ui.runSrt.getText().toString() === '开始运行') {
        // 一直保持屏幕常亮
        device.keepScreenOn();
        threads.start(main);
        ui.runSrt.setText('停止运行');
    } else {
        // 关闭悬浮时间 = 0
        //sleep(120)
        floaty.closeAll();
        console.hide();
        device.cancelKeepingAwake();
        ui.runSrt.setText('开始运行');
        threads.shutDownAll();
    }

});
function main() {
    var _0x1bde29 = {
        'jCBzC': function _0x4a3275(_0xa1249b) {
            return _0xa1249b();
        },
        'vzVws': function _0x4c985(_0x49623a, _0xf29aa6) {
            return _0x49623a == _0xf29aa6;
        },
        'Kggjv': function _0x578c91(_0x166684, _0x5420ea) {
            return _0x166684(_0x5420ea);
        },
        'aXyzg': function _0x3bef02(_0x686ddb, _0x5cbcd6) {
            return _0x686ddb(_0x5cbcd6);
        },
        'hMNdN': 'volume_up',
        'sOzOd': function _0x1a2a87(_0x19ba21, _0x3147f5) {
            return _0x19ba21 + _0x3147f5;
        },
        'JBJTH': function _0x35bbec(_0x53a154, _0x57e1c5) {
            return _0x53a154 + _0x57e1c5;
        },
        'zmMCX': '脚本开始运行，当前时间偏移: ',
        'dKktv': '(已自动修正) 网络延迟: ',
        'rRakW': function _0x3e88ce(_0x3fed5e, _0x332938) {
            return _0x3fed5e(_0x332938);
        },
        'PKoCw': '按 音量上键 停止运行中的脚本。',
        'kJeTQ': function _0x5d85a7(_0x16c211, _0x2e7f10) {
            return _0x16c211 - _0x2e7f10;
        },
        'BsPrT': function _0x432e67(_0x20817f, _0x305ed2) {
            return _0x20817f(_0x305ed2);
        },
        'XKQOV': '时间已过！',
        'HkAer': function _0x1716ed(_0x33ebf1, _0x396ed0) {
            return _0x33ebf1 - _0x396ed0;
        },
        'dlYMW': function _0x25c342(_0x406154, _0xfb6e78) {
            return _0x406154 * _0xfb6e78;
        },
        'SPaMW': function _0x312386(_0x26ca8e, _0xc2d1e3) {
            return _0x26ca8e(_0xc2d1e3);
        },
        'eQCnC': function _0x4246c4(_0x5b0b80, _0x58e391) {
            return _0x5b0b80 / _0x58e391;
        },
        'uEmPg': function _0x540edb(_0x3a8488, _0x48ea44) {
            return _0x3a8488 + _0x48ea44;
        },
        'oABZV': '计划于'
    };
    floaty['closeAll']();
    console['show']();
    events['observeKey']();
    events['onKeyDown'](_0x1bde29['hMNdN'], function(_0x23af7e) {
        var _0x504ad4 = {
            'stxFD': '开始运行',
            'YYvIt': function _0x388ef0(_0x57f804, _0x12fc57) {
                return _0x57f804(_0x12fc57);
            },
            'JZZbg': '已停止运行脚本！'
        };
        var _0xbcf069 = '3|6|5|1|0|2|4' ['split']('|'),
            _0xb13dac = 0x0;
        while (!![]) {
            switch (_0xbcf069[_0xb13dac++]) {
                case '0':
                    device['cancelKeepingAwake']();
                    continue;
                case '1':
                    console['hide']();
                    continue;
                case '2':
                    ui['runSrt']['setText'](_0x504ad4['stxFD']);
                    continue;
                case '3':
                    _0x504ad4['YYvIt'](logWithTime, _0x504ad4['JZZbg']);
                    continue;
                case '4':
                    threads['shutDownAll']();
                    continue;
                case '5':
                    floaty['closeAll']();
                    continue;
                case '6':
                    _0x504ad4['YYvIt'](toast, '已停止运行执行中的脚本！');
                    continue;
            }
            break;
        }
    });
    悬浮时间();
    logWithTime(_0x1bde29['sOzOd'](_0x1bde29['sOzOd'](_0x1bde29['JBJTH'](_0x1bde29['zmMCX'], wlsjc), _0x1bde29['dKktv']), 网络延时));
    _0x1bde29['rRakW'](logWithTime, _0x1bde29['PKoCw']);
    var _0xd8a326 = new Date(Date['parse'](startTime))['getTime']();
    startChecktimeFix = _0x1bde29['kJeTQ'](_0xd8a326, forwardTime);
    var _0x15097d = getNow();
    if (_0x15097d > startChecktimeFix - 0x7d0) {
        _0x1bde29['BsPrT'](toast, _0x1bde29['XKQOV']);
        console['hide']();
        device['cancelKeepingAwake']();
        ui['runSrt']['setText']('开始运行');
        threads['shutDownAll']();
        return;
    }
    xyz();
    var _0x376d66 = _0x1bde29['HkAer'](startChecktimeFix, _0x15097d);
    var _0x3e2df9 = _0x1bde29['BsPrT'](parseInt, _0x376d66 / 0xea60);
    var _0x28b314 = _0x1bde29['HkAer'](_0x376d66, _0x1bde29['dlYMW'](_0x3e2df9, 0xea60));
    var _0x28b314 = _0x1bde29['SPaMW'](parseInt, _0x1bde29['eQCnC'](_0x28b314, 0x3e8));
    _0x1bde29['SPaMW'](logWithTime, _0x1bde29['uEmPg'](_0x1bde29['uEmPg'](_0x1bde29['oABZV'], _0x3e2df9) + '分' + _0x28b314, '秒后执行点击'));
    var _0x578902 = 0x0;
    z = setInterval(function() {
        var _0x31a4d7 = _0x1bde29['jCBzC'](getNow);
        if (startChecktimeFix - _0x31a4d7 < 0xc350 && _0x1bde29['vzVws'](_0x578902, 0x0)) {
            _0x578902 = 0x1;
            threads['start'](function() {
                var _0x4736cb = {
                    'pGQoW': function _0x434705(_0x96e76e, _0x20b12c) {
                        return _0x96e76e === _0x20b12c;
                    },
                    'JlpOv': 'PQS',
                    'iPBMF': '5|6|4|2|0|1|3',
                    'txses': '开始运行',
                    'OLpuI': function _0x851928(_0x515350, _0xf7ecc1) {
                        return _0x515350(_0xf7ecc1);
                    },
                    'xgepJ': '已停止运行脚本！',
                    'FzWmi': '已停止运行执行中的脚本！'
                };
                if (_0x4736cb['pGQoW'](_0x4736cb['JlpOv'], 'puC')) {
                    var _0x2d525c = _0x4736cb['iPBMF']['split']('|'),
                        _0x37bc23 = 0x0;
                    while (!![]) {
                        switch (_0x2d525c[_0x37bc23++]) {
                            case '0':
                                device['cancelKeepingAwake']();
                                continue;
                            case '1':
                                ui['runSrt']['setText'](_0x4736cb['txses']);
                                continue;
                            case '2':
                                console['hide']();
                                continue;
                            case '3':
                                threads['shutDownAll']();
                                continue;
                            case '4':
                                floaty['closeAll']();
                                continue;
                            case '5':
                                _0x4736cb['OLpuI'](logWithTime, _0x4736cb['xgepJ']);
                                continue;
                            case '6':
                                _0x4736cb['OLpuI'](toast, _0x4736cb['FzWmi']);
                                continue;
                        }
                        break;
                    }
                } else {
                    网络校时();
                    dj();
                }
            });
            _0x1bde29['Kggjv'](sleep, 0x7d0);
            _0x1bde29['aXyzg'](clearInterval, z);
        }
    }, 0x3e8);
};;
var按钮x = 100;
var按钮y = 100;
var window1;

function sjys() {
    if (daske) {
        var x1 = 100 + Math.floor(Math.random() * 500);
        sleep(x1)
    };
    if (sjysm == 1) {
        var x1 = sjyssj2 - sjyssj1;
        var x1 = sjyssj1 + Math.floor(Math.random() * x1);
        if (x1 > 1) {
            sleep(x1)
        }
    }
};

function dj() {
    已完成线程数 = 0;
    var nowTime = getNow();
    var ycsj = startChecktimeFix - nowTime;
    if (ycsj > 0) {
        sleep(ycsj)
    }
    var zxc1 = djl.split("<<>>线程|");
    for (zxc = 0; zxc < zxc1.length - 1; zxc++) {
        dengdai = true;
        var zxcs = zxc1[zxc + 1].split("|_|");
        xhcs = zxcs[0];
        xcbsz = zxc + 1;
        子线程程序 = zxcs[1];
        threads.start(function() {
            zxxc()
        });
        while (dengdai) {
            sleep(5)
        }
    }
}
var dengdai, 子线程程序, 已完成线程数, xcbsz, xhcs;

function zxxc() {
    var arrz = 子线程程序.split("<->");
    var xcbs = xcbsz;
    var zxhcs = xhcs;
    dengdai = false;
    for (ii = 0; ii < zxhcs; ii++) {
        var b = ii + 1;
        logWithTime("开始第" + b + "轮执行");
        for (i = 0; i < arrz.length - 1; i++) {
            var arr = arrz[i].split("|");
            if (arr[0] == "坐标点击") {
                var yfjcs = 0;
                while (yfjcs < parseInt(arr[3])) {
                    yfjcs = yfjcs + 1;
                    logWithTime("开始模拟按下");
                    if (sjpym == 0) {
                        if (djms == 1) {
                            swipe(parseInt(arr[1]), parseInt(arr[2]), parseInt(arr[1]) + 5, parseInt(arr[2]) + 5, parseInt(arr[5]))
                        } else if (djms == 3) {
                            click(parseInt(arr[1]), parseInt(arr[2]))
                        } else if (djms == 2) {
                            press(parseInt(arr[1]), parseInt(arr[2]), parseInt(arr[5]))
                        }
                    } else {
                        var xx = parseInt(arr[1]) + Math.floor(Math.random() * sjpyz);
                        var xy = parseInt(arr[2]) + Math.floor(Math.random() * sjpyz);
                        if (djms == 1) {
                            swipe(xx, xy, xx + 5, xy + 5, parseInt(arr[5]))
                        } else if (djms == 3) {
                            click(xx, xy)
                        } else if (djms == 2) {
                            press(xx, xy, parseInt(arr[5]))
                        }
                    }
                    var a = i + 1;
                    logWithTime("第" + a + "个点，第" + yfjcs + "次模拟抬起完成");
                    if (parseInt(arr[4]) > 0) {
                        sleep(parseInt(arr[4]))
                    }
                    sjys()
                }
            } else if (arr[0] == "找字点击") {
                if (arr[1] == "用模式1找(包含)") {
                    if (arr[3] == "找到后用方法1点击该字") {
                        textContains(arr[2]).findOne().click();
                        logWithTime("找到并点击完成")
                    } else if (arr[3] == "找到后用方法2点击该字") {
                        var scope = textContains(arr[2]).findOne().bounds();
                        var dx = parseInt(scope.centerX());
                        var dy = parseInt(scope.centerY());
                        sjys();
                        press(dx, dy, 10);
                        logWithTime("找到并点击完成")
                    } else {
                        textContains(arr[2]).findOne();
                        for (i = 0; i < parseInt(arr[5]); i++) {
                            sjys();
                            press(parseInt(arr[4]), parseInt(arr[5]), 10);
                            logWithTime("点击完成");
                            if (parseInt(arr[6]) > 0) {
                                sleep(parseInt(arr[6]))
                            }
                        }
                    }
                } else if (arr[1] == "用模式1找(全对)") {
                    if (arr[3] == "找到后用方法1点击该字") {
                        text(arr[2]).findOne().click();
                        logWithTime("找到并点击完成")
                    } else if (arr[3] == "找到后用方法2点击该字") {
                        var scope = text(arr[2]).findOne().bounds();
                        var dx = parseInt(scope.centerX());
                        var dy = parseInt(scope.centerY());
                        sjys();
                        press(dx, dy, 10);
                        logWithTime("找到并点击完成")
                    } else {
                        text(arr[2]).findOne();
                        for (i = 0; i < parseInt(arr[5]); i++) {
                            sjys();
                            press(parseInt(arr[4]), parseInt(arr[5]), 10);
                            logWithTime("点击完成");
                            if (parseInt(arr[6]) > 0) {
                                sleep(parseInt(arr[6]))
                            }
                        }
                    }
                } else if (arr[1] == "用模式2找(包含)") {
                    if (arr[3] == "找到后用方法1点击该字") {
                        descContains(arr[2]).findOne().click();
                        logWithTime("找到并点击完成")
                    } else if (arr[3] == "找到后用方法2点击该字") {
                        var scope = descContains(arr[2]).findOne().bounds();
                        var dx = parseInt(scope.centerX());
                        var dy = parseInt(scope.centerY());
                        press(dx, dy, 10);
                        logWithTime("找到并点击完成")
                    } else {
                        descContains(arr[2]).findOne();
                        for (i = 0; i < parseInt(arr[5]); i++) {
                            sjys();
                            press(parseInt(arr[4]), parseInt(arr[5]), 10);
                            logWithTime("点击完成");
                            if (parseInt(arr[6]) > 0) {
                                sleep(parseInt(arr[6]))
                            }
                        }
                    }
                } else if (arr[1] == "用模式2找(全对)") {
                    if (arr[3] == "找到后用方法1点击该字") {
                        desc(arr[2]).findOne().click();
                        logWithTime("找到并点击完成")
                    } else if (arr[3] == "找到后用方法2点击该字") {
                        var scope = desc(arr[2]).findOne().bounds();
                        var dx = parseInt(scope.centerX());
                        var dy = parseInt(scope.centerY());
                        press(dx, dy, 10);
                        logWithTime("找到并点击完成")
                    } else {
                        desc(arr[2]).findOne();
                        for (i = 0; i < parseInt(arr[5]); i++) {
                            press(parseInt(arr[4]), parseInt(arr[5]), 10);
                            logWithTime("点击完成");
                            if (parseInt(arr[6]) > 0) {
                                sleep(parseInt(arr[6]))
                            }
                        }
                    }
                }
            } else if (arr[0] == "延时") {
                logWithTime("执行延时");
                if (parseInt(arr[1]) > 0) {
                    sleep(parseInt(arr[1]))
                }
            } else if (arr[0] == "结束") {
                logWithTime("结束执行");
                device.cancelKeepingAwake();
                threads.shutDownAll()
            } else if (arr[0] == "输入") {
                setText(arr[1])
            }
        }
    }
    已完成线程数 = 已完成线程数 + 1;
    if (已完成线程数 = xcbsz) {
        logWithTime("所有线程执行完毕！");
        device.cancelKeepingAwake();
        sleep(1000);
        threads.shutDownAll()
    } else {
        logWithTime("线程" + xcbs + "执行完毕！")
    }
};

var content = storage['get']('使用次数');
if (content != null) {
    使用次数 = parseInt(content);
}
if (storage['get']('使用次数')) {
    threads['start'](function() {
        var _0x16e2d3 = {
            'IkgiI': function _0x5d5121(_0x18adae) {
                return _0x18adae();
            }
        };
        _0x16e2d3['IkgiI'](检测更新);
    });
}

function 检测更新() {
  //https://520xzs.lanzous.com/b00zhobfi
}

function xyz() {
    var _0x48850c = {
        'EbySC': 'xym',
        'uJiyk': function _0xe322d8(_0x3963d7, _0x55a107) {
            return _0x3963d7 == _0x55a107;
        },
        'UMRdl': function _0x1eefdb(_0x1688f3, _0x2e3fc5) {
            return _0x1688f3 !== _0x2e3fc5;
        },
        'COLUv': 'QYx',
        'KFTCN': function _0x12d468(_0x33fad1, _0x2fe1da) {
            return _0x33fad1(_0x2fe1da);
        },
        'GKAiR': function _0x59b637(_0x7d4ecd) {
            return _0x7d4ecd();
        },
        'hEnZo': function _0x21cf94(_0x20e123, _0x54e1d8) {
            return _0x20e123(_0x54e1d8);
        },
        'OYJOr': '服务器异常',
        'xmCQt': 'oqq'
    };
    if (storage['get'](_0x48850c['EbySC'])) {
        yourId = storage['get']('设备id');
        var _0x317720 = yourId['substr'](0x3, 0x5) * 0x3;
        if (_0x48850c['uJiyk'](_0x317720, storage['get'](_0x48850c['EbySC']))) {
            if (_0x48850c['UMRdl'](_0x48850c['COLUv'], 'XZR')) {
                daske = ![];
            } else {
                _0x48850c['KFTCN'](toast, '授权已过期，请重新获取授权！');
                _0x48850c['GKAiR'](新激活);
            }
        } else {
            daske = !![];
            _0x48850c['hEnZo'](toast, _0x48850c['OYJOr']);
        }
    } else {
        if (_0x48850c['xmCQt'] !== _0x48850c['xmCQt']) {} else {
            daske = !![];
            _0x48850c['hEnZo'](toast, '服务器异常');
        }
    }
}
var 激活 = ![],
    授权内容, yourId, daske, 激活码, IMEI, 检测更新完毕 = ![];
threads['start'](function() {
    var _0x3b8f02 = {
        'QjjnH': function _0x1fd876(_0x30b386, _0x191641) {
            return _0x30b386(_0x191641);
        },
        'QeUAa': '到期时间',
        'GQmLp': 'LCd',
        'BpgWq': function _0x5d0e64(_0x158fe7) {
            return _0x158fe7();
        },
        'xjGSK': function _0x55c874(_0x1ff1c6, _0x37d142) {
            return _0x1ff1c6 !== _0x37d142;
        },
        'LrHNp': 'RUR',
        'BGVuK': 'hFb',
        'HKEpt': function _0x24cf95(_0x388e41, _0x502f70) {
            return _0x388e41 > _0x502f70;
        },
        'dVgFn': function _0x50b764(_0x405bbb, _0x1916d0) {
            return _0x405bbb !== _0x1916d0;
        },
        'imypp': function _0x35c63b(_0x2bfea4, _0x2e6f20) {
            return _0x2bfea4 * _0x2e6f20;
        },
        'zXENP': function _0x1b50db(_0x460fc6, _0x4436cb) {
            return _0x460fc6 - _0x4436cb;
        },
        'VEnYJ': function _0x31499e(_0x5ad9ae, _0x1c008d) {
            return _0x5ad9ae == _0x1c008d;
        },
        'gJUEJ': function _0xd7beb5(_0xc7cb32, _0x5c8bdf) {
            return _0xc7cb32(_0x5c8bdf);
        },
        'pLNTh': '授权已过期，请重新获取授权！',
        'GZfWm': function _0x5ad06a(_0x23de43, _0x1934f7) {
            return _0x23de43 + _0x1934f7;
        }
    };
    _0x3b8f02['QjjnH'](sleep, 0x3e8);
    if (!storage['get'](_0x3b8f02['QeUAa'])) {
        if (_0x3b8f02['GQmLp'] !== 'LHo') {
            _0x3b8f02['BpgWq'](新激活);
        } else {
            激活 = !![];
        }
    } else {
        if (_0x3b8f02['xjGSK'](_0x3b8f02['LrHNp'], _0x3b8f02['BGVuK'])) {
            var _0x4835f3 = storage['get'](_0x3b8f02['QeUAa']);
            if (_0x3b8f02['HKEpt'](_0x4835f3, getNow())) {
                if (_0x3b8f02['dVgFn']('aRc', 'LMX')) {
                    激活 = !![];
                } else {
                    pos = Math['round'](_0x3b8f02['imypp'](Math['random'](), _0x3b8f02['zXENP'](arr['length'], 0x1)));
                    str += arr[pos];
                }
            } else {
                _0x3b8f02['QjjnH'](sleep, 0x1388);
                if (_0x3b8f02['VEnYJ'](激活, !![])) {} else {
                    _0x3b8f02['gJUEJ'](toast, _0x3b8f02['pLNTh']);
                    _0x3b8f02['BpgWq'](新激活);
                }
            }
        } else {
            range = _0x3b8f02['GZfWm'](Math['round'](_0x3b8f02['imypp'](Math['random'](), _0x3b8f02['zXENP'](max, min))), min);
        }
    }
});

function 新激活() {
    var _0x3749ad = {
        'voLTc': function _0x2788e5(_0x64aa61, _0x344334) {
            return _0x64aa61 == _0x344334;
        },
        'NGHmB': 'DAX',
        'QKqQd': 'fkI',
        'htIZz': function _0x96d28a(_0x4d95c4, _0x39e92a) {
            return _0x4d95c4(_0x39e92a);
        },
        'ROCaF': function _0x577ed9(_0x15f408, _0x1d427f, _0x5a015c) {
            return _0x15f408(_0x1d427f, _0x5a015c);
        },
        'ZyiXT': '请输入你的qq（首发Q群：596614201）',
        'MNdqp': '激活码卡号',
        'PojiL': function _0x431da9(_0x549f9f, _0x1408fb) {
            return _0x549f9f !== _0x1408fb;
        },
        'lXnwF': 'RUs',
        'aBdyO': '2|1|3|4|6|5|0|7',
        'Xqjwn': '设备id',
        'tBjVA': '请加群哟，即将重启，下月时间：',
        'vzEJt': 'jzW',
        'sgvQa': '9774d56d682e549c',
        'YQUTJ': function _0x568b57(_0x386c02, _0x4a3598) {
            return _0x386c02 === _0x4a3598;
        },
        'HWScN': 'JfC',
        'rllIc': 'IMEI',
        'ViojF': function _0x45f6b2(_0x3f441b, _0x425b90) {
            return _0x3f441b(_0x425b90);
        },
        'uhIUI': '获取id异常，如果用此注册，卸载后将不能激活！',
        'aVxpK': 'https://520xzs.lanz12345ous.com/b00zhobfi',
        'tSjJp': function _0x29c2d2(_0x42bd9d, _0x27e400) {
            return _0x42bd9d > _0x27e400;
        },
        'XUHTJ': function _0x2a6875(_0x1c7bc8) {
            return _0x1c7bc8();
        },
        'jEAUb': function _0x34f967(_0x190a44, _0x28c0d7) {
            return _0x190a44(_0x28c0d7);
        },
        'QPiSe': '1236542586364',
        'xEVMe': function _0x212d38(_0x33b76e, _0x3f6a42) {
            return _0x33b76e(_0x3f6a42);
        },
        'JZKEK': 'oir',
        'rZxQL': '1365478962452',
        'xATVf': function _0x3061b6(_0x3b283f, _0x3b2a60) {
            return _0x3b283f === _0x3b2a60;
        },
        'SjtCu': function _0xfe2c5f(_0xe4e71c, _0x1a984a) {
            return _0xe4e71c(_0x1a984a);
        },
        'iZbrx': '服务器异常',
        'iVcrZ': '此号已被其它机器绑定！',
        'mQoPp': function _0x4b5893(_0x3f43f7, _0x1eb807) {
            return _0x3f43f7 === _0x1eb807;
        },
        'AkMGq': 'nic',
        'DosEL': function _0x274e0d(_0x4b56c6, _0x280a40) {
            return _0x4b56c6 > _0x280a40;
        },
        'TRNFB': function _0x5d185f(_0xf7e38d) {
            return _0xf7e38d();
        },
        'xOGyc': function _0x227aae(_0x2a5c2f, _0x516530) {
            return _0x2a5c2f(_0x516530);
        },
        'VospA': function _0x1a5a12(_0x4ba410, _0x10612f) {
            return _0x4ba410 + _0x10612f;
        },
        'xKYeI': '到期时间',
        'HDlvv': function _0x2ce2d0(_0x290849, _0x48da75) {
            return _0x290849 !== _0x48da75;
        },
        'EckEJ': 'IzQ',
        'IpAbC': '删除版本号，js会定期弹窗',
        'SxBom': '此号未取得授权！'
    };
    while (_0x3749ad['voLTc'](激活, ![])) {
        if (_0x3749ad['NGHmB'] === _0x3749ad['QKqQd']) {
            使用次数 = _0x3749ad['htIZz'](parseInt, content);
        } else {
            激活码 = _0x3749ad['ROCaF'](rawInput, _0x3749ad['ZyiXT'], storage['get'](_0x3749ad['MNdqp']));
            if (_0x3749ad['voLTc'](激活码, null)) {
                if (_0x3749ad['PojiL'](_0x3749ad['lXnwF'], 'RUs')) {
                    var _0x491ebf = _0x3749ad['aBdyO']['split']('|'),
                        _0x5e3882 = 0x0;
                    while (!![]) {
                        switch (_0x491ebf[_0x5e3882++]) {
                            case '0':
                                storage['put'](_0x3749ad['Xqjwn'], yourId);
                                continue;
                            case '1':
                                var _0x31c995 = new Date(parseInt(授权内容['substr'](0x5, 0xd)))['toLocaleString']()['replace'](/:\d{1,2}$/, ' ');
                                continue;
                            case '2':
                                激活 = !![];
                                continue;
                            case '3':
                                _0x3749ad['htIZz'](alert, _0x3749ad['tBjVA'] + _0x31c995);
                                continue;
                            case '4':
                                storage['put']('到期时间', 授权内容['substr'](0x5, 0xd));
                                continue;
                            case '5':
                                storage['put']('xym', 授权内容['substr'](0x2b));
                                continue;
                            case '6':
                                storage['put'](_0x3749ad['MNdqp'], 激活码);
                                continue;
                            case '7':
                                ui['finish']();
                                continue;
                        }
                        break;
                    }
                } else {
                    ui['finish']();
                }
            } else {
                if (_0x3749ad['PojiL']('drO', _0x3749ad['vzEJt'])) {
                    IMEI = device['getAndroidId']();
                    if (_0x3749ad['sgvQa'] == IMEI) {
                        if (_0x3749ad['YQUTJ'](_0x3749ad['HWScN'], _0x3749ad['HWScN'])) {
                            IMEI = _0x3749ad['ROCaF'](randomId, ![], 0xa);
                            storage['put'](_0x3749ad['rllIc'], IMEI);
                            _0x3749ad['ViojF'](alert, _0x3749ad['uhIUI']);
                        } else {
                            app['openUrl'](_0x3749ad['aVxpK']);
                        }
                    }
                    yourId = randomId(![], 0x18);
                    var _0x4f6f2f = threads['start'](function() {
                        var _0x202cb2 = {
                            'YDVPN': 'http://118.24.117.154:6666/',
                            'AIPOK': function _0x20727d(_0x269582) {
                                return _0x269582();
                            },
                            'XZVNR': function _0x4eb98c(_0x5a4622, _0x2f3c22) {
                                return _0x5a4622(_0x2f3c22);
                            },
                            'nlbHU': '激活成功，即将重启，到期时间：',
                            'rodzo': '到期时间',
                            'DfUpB': '激活码卡号',
                            'iwugd': 'xym',
                            'UKJIu': '设备id',
                            'Vpefl': function _0x59aae1(_0x1c7e33, _0x1d0f0a) {
                                return _0x1c7e33(_0x1d0f0a);
                            },
                            'SqHse': '此号未取得授权！'
                        };
                        if ('beR' === 'beR') {
                            var _0xa8ba6a = _0x202cb2['YDVPN'];
                            var _0x15e8f2 = http['post'](_0xa8ba6a, {
                                'lx': '100',
                                'IMEI': IMEI,
                                'Id': yourId,
                                'password': 激活码
                            });
                            授权内容 = _0x15e8f2['body']['string']();
                        } else {
                            if (授权内容['substr'](0x5, 0xd) > _0x202cb2['AIPOK'](getNow)) {
                                激活 = !![];
                                var _0x3241ed = new Date(_0x202cb2['XZVNR'](parseInt, 授权内容['substr'](0x5, 0xd)))['toLocaleString']()['replace'](/:\d{1,2}$/, ' ');
                                alert(_0x202cb2['nlbHU'] + _0x3241ed);
                                storage['put'](_0x202cb2['rodzo'], 授权内容['substr'](0x5, 0xd));
                                storage['put'](_0x202cb2['DfUpB'], 激活码);
                                storage['put'](_0x202cb2['iwugd'], 授权内容['substr'](0x2b));
                                storage['put'](_0x202cb2['UKJIu'], yourId);
                                ui['finish']();
                            } else {
                                _0x202cb2['Vpefl'](toast, _0x202cb2['SqHse']);
                            }
                        }
                    });
                    _0x4f6f2f['join'](0xbb8);
                    if (_0x3749ad['tSjJp'](授权内容['substr'](0x1e, 0xd) - 0x2710, _0x3749ad['XUHTJ'](getNow)) || _0x3749ad['XUHTJ'](getNow) > 授权内容['substr'](0x1e, 0xd) + 0x2710) {
                        _0x3749ad['jEAUb'](alert, '服务器异常，请联系管理员！');
                        ui['finish']();
                    }
                    if (_0x3749ad['voLTc'](授权内容['substr'](0x5, 0xd), _0x3749ad['QPiSe'])) {
                        _0x3749ad['xEVMe'](alert, '此号授权已到期！');
                    } else {
                        if (_0x3749ad['YQUTJ'](_0x3749ad['JZKEK'], _0x3749ad['JZKEK'])) {
                            if (_0x3749ad['voLTc'](授权内容['substr'](0x5, 0xd), _0x3749ad['rZxQL'])) {
                                if (_0x3749ad['xATVf']('Etm', 'vnU')) {
                                    yourId = storage['get']('设备id');
                                    var _0x37536f = yourId['substr'](0x3, 0x5) * 0x3;
                                    if (_0x37536f == storage['get']('xym')) {
                                        daske = ![];
                                    } else {
                                        daske = !![];
                                        _0x3749ad['SjtCu'](toast, _0x3749ad['iZbrx']);
                                    }
                                } else {
                                    _0x3749ad['SjtCu'](alert, _0x3749ad['iVcrZ']);
                                }
                            } else {
                                if (_0x3749ad['mQoPp'](_0x3749ad['AkMGq'], 'nic')) {
                                    if (_0x3749ad['DosEL'](授权内容['substr'](0x5, 0xd), _0x3749ad['TRNFB'](getNow))) {
                                        激活 = !![];
                                        var _0x2c6967 = new Date(_0x3749ad['xOGyc'](parseInt, 授权内容['substr'](0x5, 0xd)))['toLocaleString']()['replace'](/:\d{1,2}$/, ' ');
                                        alert(_0x3749ad['VospA'](_0x3749ad['tBjVA'], _0x2c6967));
                                        storage['put'](_0x3749ad['xKYeI'], 授权内容['substr'](0x5, 0xd));
                                        storage['put']('激活码卡号', 激活码);
                                        storage['put']('xym', 授权内容['substr'](0x2b));
                                        storage['put'](_0x3749ad['Xqjwn'], yourId);
                                        ui['finish']();
                                    } else {
                                        if (_0x3749ad['HDlvv'](_0x3749ad['EckEJ'], 'IzQ')) {
                                            w[c](_0x3749ad['IpAbC']);
                                        } else {
                                            _0x3749ad['xOGyc'](toast, _0x3749ad['SxBom']);
                                        }
                                    }
                                } else {
                                    daske = !![];
                                    _0x3749ad['xOGyc'](toast, _0x3749ad['iZbrx']);
                                }
                            }
                        } else {
                            alert('客户端激活失败,请联系管理员！');
                            ui['finish']();
                        }
                    }
                } else {
                    daske = ![];
                }
            }
        }
    }
}

function randomId(_0x4db7e8, _0x255463, _0xb183d8) {
    var _0x53c5f4 = {
        'VCBYi': function _0x15786a(_0x2d03c6, _0x3b432e) {
            return _0x2d03c6 === _0x3b432e;
        },
        'mIiEQ': 'AVz',
        'rwQeN': function _0x242a92(_0x133c68, _0x1c9cfc) {
            return _0x133c68 + _0x1c9cfc;
        },
        'JwyGE': function _0x3b0e61(_0x47c8a9, _0x52fe77) {
            return _0x47c8a9 * _0x52fe77;
        },
        'cfXzS': function _0x52124d(_0x1369ab, _0x17c327) {
            return _0x1369ab - _0x17c327;
        },
        'ECUVc': 'zLw',
        'TMwAZ': function _0x41b053(_0x45b3d5, _0x52951e) {
            return _0x45b3d5 * _0x52951e;
        },
        'ktipl': function _0x578f63(_0x149cbc, _0x499753) {
            return _0x149cbc - _0x499753;
        }
    };
    var _0x26b3c3 = '',
        _0x519cbd = _0x255463,
        _0x5b16b5 = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
    if (_0x4db7e8) {
        if (_0x53c5f4['VCBYi'](_0x53c5f4['mIiEQ'], 'Lpl')) {
            激活 = !![];
        } else {
            _0x519cbd = _0x53c5f4['rwQeN'](Math['round'](_0x53c5f4['JwyGE'](Math['random'](), _0x53c5f4['cfXzS'](_0xb183d8, _0x255463))), _0x255463);
        }
    }
    for (var _0x2c07f9 = 0x0; _0x2c07f9 < _0x519cbd; _0x2c07f9++) {
        if ('zBz' !== _0x53c5f4['ECUVc']) {
            pos = Math['round'](_0x53c5f4['TMwAZ'](Math['random'](), _0x53c5f4['ktipl'](_0x5b16b5['length'], 0x1)));
            _0x26b3c3 += _0x5b16b5[pos];
        } else {}
    }
    return _0x26b3c3;
};
function 悬浮时间() {
    threads.start(function () {
        var window = floaty.window(
            <frame gravity="center">
                <text id="text" textSize="22sp" textColor="#f44336" />
                {/* <button id="text" textSize="22sp" color="#ff5722" textColor="#f44336"  style="Widget.AppCompat.Button.Borderless.Colored" w="auto"/> */}
            </frame>
        );

        window.text.click(() => {
            window.setAdjustEnabled(!window.isAdjustEnabled());
        });
        window.setPosition(device.width * 0.2, 50)
        var str = formatDate(getNow())
        var str = str.substr(9, 3)
        sleep(990 - parseInt(str))
        setInterval(() => {
            ui.run(function () {
                var str = formatDate(getNow())
                var str = str.substr(0, 10)
                window.text.setText(str);

            });
        }, 100);

    });
}

function 显示按钮啦() {

    threads.start(function () {
        var window1 = floaty.window(
            <frame>
                <button id="action" text="点哪里" w="60" h="40" bg="#77ffffff" />
            </frame>
        );

        ; setInterval(() => { }, 1000); var execution = null; var x = 0, y = 0; var window1X, window1Y; window1.action.setOnTouchListener(function (view, event) { switch (event.getAction()) { case event.ACTION_DOWN: x = event.getRawX(); y = event.getRawY(); window1X = window1.getX(); window1Y = window1.getY(); return true; case event.ACTION_MOVE: window1.setPosition(window1X + (event.getRawX() - x), window1Y + (event.getRawY() - y)); return true; case event.ACTION_UP: 按钮x = event.getRawX(); 按钮y = event.getRawY(); return true }return true });;
    });



}
function getTime1() {

    var d = new Date()
    var 分 = d.getMinutes()
    var 时 = d.getHours()
    if (分 > 29) { 分 = "00"; 时 = 时 + 1 } else { 分 = 30 }
    if (时 < 10) { 时 = "0" + 时 };


    var 年 = d.getFullYear()
    var 月 = d.getMonth() + 1
    var 日 = d.getDate()
    if (时 == 24) {
        时 = 00;
        日 = 日 + 1;
    };

    return 年 + "/" + 月 + "/" + 日 + " " + 时 + ":" + 分 + ":" + "00"
}



